package itheima.service;


import itheima.dao.BaseMetroDao;
import itheima.domain.Card;
import itheima.factory.MetroFactory;

import java.util.ArrayList;

public class MetroService {
    private static BaseMetroDao md = MetroFactory.getDao();



    public ArrayList<String> getStations() {
        ArrayList<String> stations = md.getStations();
        return stations;
    }

    public int isExist(String cardId) {
        int index = md.isExist(cardId);
        return index;
    }

    public void saveUserLog(String log) {
        md.saveUserLog(log);
    }

    public boolean addUser(Card card) {
        boolean flag = md.addUser(card);
        return flag;
    }

    public boolean verify(String cardId, String x) {
        boolean flag = md.verify(cardId,x);
        return flag;
    }

    public String getUsername(String cardId) {
        String username = md.getUsername(cardId);
        return username;
    }

    public double giveMoney(String cardId) {
        double money = md.giveMoney(cardId);
        return money;
    }

    public boolean charge(String cardId, double money) {
        boolean flag = md.charge(cardId,money);
        return flag;
    }

    public String buyTicket(String cardId, String startStation, String endStation) {
        String flag = md.buyTicket(cardId,startStation,endStation);
        return flag;
    }
}
